package parser

import (
	"github.com/anqiansong/sqlgen/internal/spec"
	"github.com/pingcap/parser/mysql"
)

var funcMap = map[string]byte{
	// spec.TypeNullLongLong
	"count":          spec.TypeNullLongLong,
	"length":         spec.TypeNullLongLong,
	"char_length":    spec.TypeNullLongLong,
	"locate":         spec.TypeNullLongLong,
	"position":       spec.TypeNullLongLong,
	"instr":          spec.TypeNullLongLong,
	"field":          spec.TypeNullLongLong,
	"sign":           spec.TypeNullLongLong,
	"mod":            spec.TypeNullLongLong,
	"unix_timestamp": spec.TypeNullLongLong,
	"sysdate":        spec.TypeNullLongLong,
	"utc_date":       spec.TypeNullLongLong,
	"utc_time":       spec.TypeNullLongLong,
	"month":          spec.TypeNullLongLong,
	"day":            spec.TypeNullLongLong,
	"dayofmonth":     spec.TypeNullLongLong,
	"dayofweek":      spec.TypeNullLongLong,
	"dayofyear":      spec.TypeNullLongLong,
	"week":           spec.TypeNullLongLong,
	"weekday":        spec.TypeNullLongLong,
	"weekofyear":     spec.TypeNullLongLong,
	"quarter":        spec.TypeNullLongLong,
	"hour":           spec.TypeNullLongLong,
	"minute":         spec.TypeNullLongLong,
	"second":         spec.TypeNullLongLong,
	"extract":        spec.TypeNullLongLong,
	"time_to_sec":    spec.TypeNullLongLong,
	"to_days":        spec.TypeNullLongLong,
	"to_seconds":     spec.TypeNullLongLong,
	"datadiff":       spec.TypeNullLongLong,

	// spec.TypeNullDecimal
	"avg":      spec.TypeNullDecimal,
	"abs":      spec.TypeNullDecimal,
	"ceil":     spec.TypeNullDecimal,
	"floor":    spec.TypeNullDecimal,
	"round":    spec.TypeNullDecimal,
	"rand":     spec.TypeNullDecimal,
	"pi":       spec.TypeNullDecimal,
	"truncate": spec.TypeNullDecimal,
	"pow":      spec.TypeNullDecimal,
	"sqrt":     spec.TypeNullDecimal,
	"exp":      spec.TypeNullDecimal,
	"log":      spec.TypeNullDecimal,
	"log10":    spec.TypeNullDecimal,
	"radians":  spec.TypeNullDecimal,
	"degrees":  spec.TypeNullDecimal,
	"sin":      spec.TypeNullDecimal,
	"cos":      spec.TypeNullDecimal,
	"tan":      spec.TypeNullDecimal,
	"cot":      spec.TypeNullDecimal,
	"asin":     spec.TypeNullDecimal,
	"acos":     spec.TypeNullDecimal,
	"atan":     spec.TypeNullDecimal,

	// spec.TypeNullString
	"concat_ws":     spec.TypeNullString,
	"concat":        spec.TypeNullString,
	"insert":        spec.TypeNullString,
	"upper":         spec.TypeNullString,
	"ucaase":        spec.TypeNullString,
	"lower":         spec.TypeNullString,
	"lcase":         spec.TypeNullString,
	"left":          spec.TypeNullString,
	"right":         spec.TypeNullString,
	"lpad":          spec.TypeNullString,
	"rpad":          spec.TypeNullString,
	"replace":       spec.TypeNullString,
	"substring":     spec.TypeNullString,
	"substr":        spec.TypeNullString,
	"trim":          spec.TypeNullString,
	"ltrim":         spec.TypeNullString,
	"rtrim":         spec.TypeNullString,
	"reverse":       spec.TypeNullString,
	"repeat":        spec.TypeNullString,
	"space":         spec.TypeNullString,
	"strcmp":        spec.TypeNullString,
	"mid":           spec.TypeNullString,
	"from_unixtime": spec.TypeNullString,
	"month_name":    spec.TypeNullString,
	"day_name":      spec.TypeNullString,
	"date_format":   spec.TypeNullString,
	"time_format":   spec.TypeNullString,

	// mysql.TypeDate
	"curdate":      mysql.TypeDate,
	"current_date": mysql.TypeDate,
	"adddate":      mysql.TypeDate,
	"subdate":      mysql.TypeDate,

	// mysql.TypeDuration
	"curtime":     mysql.TypeDuration,
	"current_tim": mysql.TypeDuration,
	"now":         mysql.TypeDuration,
	"localtime":   mysql.TypeDuration,
	"sec_to_time": mysql.TypeDuration,
	"addtime":     mysql.TypeDuration,

	// mysql.TypeTimestamp
	"current_timestamp": mysql.TypeTimestamp,
	"localtimestamp":    mysql.TypeTimestamp,
}
